$(function () {
    $(".divsh").hide();
        $("#fuhetab").bootstrapTable({
            method:"post",
            contentType:'application/json',
            url:"/Kucun/aqkcpzfh",
            striped:true,
            pageNumber:1,
            pagination:true,
            sidePagination:'server',
            pageSize:3,
            pageList:[2,3,5,6],
            queryParams:function (parmes) {
                return{
                    pageNum:(parmes.offset / parmes.limit) + 1,
                    pageSize:parmes.limit,
                }
            },
            columns:[
                {title: "配置单编号",field: "storeId",align: "center"},
                {title:"产品编号",field:"productId",align:'center'},
                {title:"产品名称",field:"productName",align:'center'},
                {title:"I级分类",field:"firstKindName",align:'center'},
                {title:"II级分类",field:"secondKindName",align:'center'},
                {title:"III级分类",field:"thirdKindName",align:'center'},
                {title:"登记时间",field:"registerTime",align:'center',},
                {title: "复核",field: "id",align: "center",
                    formatter:function (value,row,index) {
                        let a="<a href='#' onclick='aqkcsh("+JSON.stringify(row)+")'>复核</a>";
                        return a;
                    }
                },
            ]
        })
})

function aqkcsh(row) {
    $("#aqkcdiv1").hide();
    $(".divsh").show();

    var date=new Date();
    var n=date.getFullYear();
    var y=date.getMonth()+1;
    var r=date.getDate();
    var s=date.getHours();
    var f=date.getMinutes();
    var m=date.getSeconds();
    var sj=n+"-"+y+"-"+r+" "+s+":"+f+":"+m;

    $("#fhsj").html(sj);

    let na = parent.document.getElementsByClassName("user_name")[0].innerHTML;

    $("#name").html(row.productName);
    $("#pzdbh").html(row.storeId);
    $("#bh").html(row.productId);
    $("#bjxx").html(row.minAmount);
    $("#bjsx").html(row.maxAmount);
    $("#ccl").html(row.maxCapacityAmount);
    $("#sjr").html(row.register);
    $("#fhr").val(na);
    $("#comment").val(row.config);
}

function fhtg() {
    let cpbh = $("#pzdbh").html();
    parent.document.getElementsByClassName("user_name")[0].innerHTML
    if (confirm("确定通过吗?")){
        $("#aqkcdiv1").show();
        $(".divsh").hide();
        $('#fuhetab').bootstrapTable('refresh');
        $.ajax({
            type:"put",
            contentType:"application/json;charset:utf-8",
            url:"/Kucun/tongguo/"+cpbh,
            dataType:"json",
            async:true,
            success:function (data) {
                parent.document.getElementById('iframeId').contentWindow.location.reload(true);
            }
        })
    }
}


function fhbtg() {
    let cpbh = $("#pzdbh").html();
    if (confirm("确定不通过吗？")){
        $("#aqkcdiv1").show();
        $(".divsh").hide();
        $('#fuhetab').bootstrapTable('refresh');
        $.ajax({
            type:"put",
            contentType:"application/json;charset:utf-8",
            url:"/Kucun/butongguo/"+cpbh,
            dataType:"json",
            async:true,
            success:function (data) {
                parent.document.getElementById('iframeId').contentWindow.location.reload(true);
            }
        })
    }
}

//刷新当前框架
function fanhui(){
    parent.document.getElementById('iframeId').contentWindow.location.reload(true);
}